package com.tgky.ybzb.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.tgky.ybzb.common.PageParam;
import com.tgky.ybzb.utils.MPUtil;
import com.tgky.ybzb.entity.Rwfa;
import com.tgky.ybzb.mapper.RwfaMapper;
import com.tgky.ybzb.service.IRwfaService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

/**
 * 任务方案 服务实现类
 *
 * @author XYP
 * @since 2024-07-22
 */
@Service
public class RwfaServiceImpl extends ServiceImpl<RwfaMapper, Rwfa> implements IRwfaService {

    /**
     * 通过实体类获取QueryWrapper
     * @param pageParam 分页参数
     * @param rwfa 实体信息
     * @return
     */
    @Override
    public QueryWrapper<Rwfa> getQueryWrapper(PageParam pageParam, Rwfa rwfa){
        QueryWrapper<Rwfa> queryWrapper = MPUtil.getQueryWrapper(pageParam);

        if(rwfa == null){
            return queryWrapper;
        }


        //TODO 此处可以根据各字段查询需求修改查询条件，eq、like、ge、gt、le、lt、ne...等等等
        queryWrapper.lambda()
                .eq(rwfa.getRwfabh() != null, Rwfa::getRwfabh, rwfa.getRwfabh())
                .eq(rwfa.getWxbs() != null, Rwfa::getWxbs, rwfa.getWxbs())
                .eq(rwfa.getYrwbh() != null, Rwfa::getYrwbh, rwfa.getYrwbh())
                .eq(rwfa.getCbj() != null, Rwfa::getCbj, rwfa.getCbj())
                .eq(rwfa.getKssj() != null, Rwfa::getKssj, rwfa.getKssj())
                .eq(rwfa.getJssj() != null, Rwfa::getJssj, rwfa.getJssj())
                .eq(rwfa.getTxbh() != null, Rwfa::getTxbh, rwfa.getTxbh())
                .eq(rwfa.getSckssj() != null, Rwfa::getSckssj, rwfa.getSckssj())
                .eq(rwfa.getScjssj() != null, Rwfa::getScjssj, rwfa.getScjssj());
        return queryWrapper;
    }
}
